﻿<?php 
	require 'include/db.php';
	$rmk=$_REQUEST['rmk'];
	$cat=$_REQUEST['cat'];
	$ct=$_REQUEST['ct'];
	$wId=$_REQUEST['wId'];
	$pmId=$_REQUEST['pmId'];
	$dmId=$_REQUEST['dmId'];
	$tvId=$_REQUEST['tvId'];
	$t2Id=$_REQUEST['t2Id'];
	//error ID
	if($t2Id!="")
	{
		$test="select * from tintuc where t2Id=".$t2Id;
		$kqua_test=mysql_query($test);
		$row_test=mysql_num_rows($kqua_test);
		if($row_test=="")
		{
			echo("<script> location.href='?rmk=catmain&cat=t2'</script>");
		}
	}
	if($tvId!="")
	{
		$test="select * from tuvan where tvId=".$tvId;
		$kqua_test=mysql_query($test);
		$row_test=mysql_num_rows($kqua_test);
		if($row_test=="")
		{
			echo("<script> location.href='?rmk=catmain&cat=tv'</script>");
		}
	}
	if($dmId!="")
	{
		$test="select * from domain where dmId=".$dmId;
		$kqua_test=mysql_query($test);
		$row_test=mysql_num_rows($kqua_test);
		if($row_test=="")
		{
			echo("<script> location.href='?rmk=catmain&cat=dm'</script>");
		}
	}
	if($pmId!="")
	{
		$test="select * from phanmem where pmId=".$pmId;
		$kqua_test=mysql_query($test);
		$row_test=mysql_num_rows($kqua_test);
		if($row_test=="")
		{
			echo("<script> location.href='?rmk=catmain&cat=pm'</script>");
		}
	}
	if($wId!="")
	{
		$test="select * from web where wId=".$wId;
		$kqua_test=mysql_query($test);
		$row_test=mysql_num_rows($kqua_test);
		if($row_test=="")
		{
			echo("<script> location.href='?rmk=catmain&cat=w'</script>");
		}
	}
	
	
	//end error ID
	$sql2=mysql_query("select * from lienhe where lhStatus=".'1');
	if($cat!="w" && $cat!="dm" && $cat!="pm" && $cat!="tv" && $cat!="t2" && $cat!="sanpham" && $cat!="dv" && $cat!="timkiem" )
	{
		$cat=dv;
	}
	if($cat=="w")
	{
		$sql=mysql_query("select * from web");
	}
	if($cat=="dm")
	{
		$sql=mysql_query("select * from domain");
	}
	if($cat=="pm")
	{
		$sql=mysql_query("select * from phanmem");
	}
	if($cat=="tv")
	{
		$sql=mysql_query("select * from tuvan");
	}
	if($cat=="t2")
	{
		//xac dinh bao nhieu dong
		$display =4;
		//tinh tong so trng can hien thi
		if(isset($_GET['page']) &&(int)$_GET['page'])
		{
			$page = $_GET['page'];
		}else
		{
		// neu chua xac dinh thi tim so trang 
			$query="select count(t2Id) from  tintuc ";
			$res=mysql_query($query);
			$row = mysql_fetch_array($res, MYSQLI_NUM);
			$record = $row[0];
			if($record > $display)
			{
				$page= ceil($record/$display);
			}else
			{
				$page = 1;
			}
		}
		$start = (isset($_GET['start']) && (int)$_GET['start']>=0) ? $_GET['start'] : 0;			
		$sql=mysql_query("select * from tintuc ORDER BY t2Id DESC LIMIT $start, $display");
	}
	
	if($cat=="sp")
	{
		//xac dinh bao nhieu dong
		$display =3;
		//tinh tong so trng can hien thi
		if(isset($_GET['page']) &&(int)$_GET['page'])
		{
			$page = $_GET['page'];
		}else
		{
		// neu chua xac dinh thi tim so trang 
			$query="select count(spId) from  sanpham ";
			$res=mysql_query($query);
			$row = mysql_fetch_array($res, MYSQLI_NUM);
			$record = $row[0];
			if($record > $display)
			{
				$page= ceil($record/$display);
			}else
			{
				$page = 1;
			}
		}
		$start = (isset($_GET['start']) && (int)$_GET['start']>=0) ? $_GET['start'] : 0;	
		$sql=mysql_query("select * from sanpham  ORDER BY t2Id DESC LIMIT $start, $display");
	}
	//error $ct
	if($ct!="w" && $ct!="dm" && $ct!="pm" && $ct!="tv" && $ct!="t2" && $ct!="sanpham" && $ct!="dv" )
	{
		$ct="";
	}
	
	
	if($ct=="w")
	{
		$sql=mysql_query("select * from web where wId=".$wId);
		$row1=mysql_fetch_array($sql);
	}
	if($ct=="dm")
	{
		$sql=mysql_query("select * from domain where dmId=".$dmId);
		$row1=mysql_fetch_array($sql);
	}
	if($ct=="pm")
	{
		$sql=mysql_query("select * from phanmem where pmId=".$pmId);
		$row1=mysql_fetch_array($sql);
	}
	if($ct=="tv")
	{
		$sql=mysql_query("select * from tuvan where tvId=".$tvId);
		$row1=mysql_fetch_array($sql);
	}
	if($ct=="t2")
	{
		$sql=mysql_query("select * from tintuc where t2Id=".$t2Id);
		$row1=mysql_fetch_array($sql);
	}
	if($ct=="sp")
	{
		$sql=mysql_query("select * from sanpham where spId=".$spId);
		$row1=mysql_fetch_array($sql);
	}
	$i=1;
?>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" href="css/global.css">
<link type="text/css" rel="stylesheet" href="css/style.css">
	<div id="main" class="grid_12">
		<div id="main" class="grid_3 alpha" style="margin-left: -13px; width: 277px;">
			<div id="catmain1" class="grid_3 alpha" align="center">
				Dịch vụ		
			</div>
			<div id="catmain2" class="grid_3 alpha" >
				<img src="img/12.jpg"  style="margin-left:10px;"/> <a href="?rmk=catmain&cat=w" >
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Web&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>	
			<div id="catmain2" class="grid_3 alpha">
				<img src="img/12.jpg"   style="margin-left:10px;"/> <a href="?rmk=catmain&cat=dm" >
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hosting & Domain&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>	
			</div>	
			<div id="catmain2" class="grid_3 alpha">
				<img src="img/12.jpg"   style="margin-left:10px;"/> <a href="?rmk=catmain&cat=pm" >
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Phần mềm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>	
			<div id="catmain2" class="grid_3 alpha">
				<img src="img/12.jpg"   style="margin-left:10px;"/> <a href="?rmk=catmain&cat=tv" >
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tư vấn&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>		
			</div>	
			<div id="catmain6" class="grid_3 alpha">
				<?php while($row2=mysql_fetch_array($sql2)){?>
				<div id="catmain61" class="grid_3 alpha">
					<script type="text/javascript" src='http://download.skype.com/share/skypebuttons/js/skypeCheck.js'>
					</script> 
					<a href='skype:<?php echo $row2['lhSkype'];?>?call'>
					<img src="img/iconskype.jpg" style='border: none; margin-top:10px; margin-left:10px;' width='87' height='27'	/></a>
					 <script type="text/javascript" src='http://download.skype.com/share/skypebuttons/js/skypeCheck.js'>
					</script> 
					<a href='skype:<?php echo $row2['lhSkype'];?>' style="text-decoration:none; color:#000000; font-size:18px;">
					<?php echo $row2['lhSkype'];?></a>
				</div>	
				<div id="catmain62" class="grid_3 alpha">
					<a href = 'ymsgr:sendim?<?php echo $row2['lhYahoo'];?>'>
				   <img src='http://opi.yahoo.com/online?u=<?php echo $row2['lhYahoo'];?>&m=g&t=2'border=0 style="margin-left:10px;" width="107px"></a>
					<a href = 'ymsgr:sendim?<?php echo $row2['lhYahoo'];?>' style="text-decoration:none; color:#000000;  font-size:18px;">
					<?php echo $row2['lhYahoo'];?></a>
				</div>		
				<div id="catmain63" class="grid_3 alpha" style="margin-left:12px;">
					Phone : <?php echo $row2['lhSDT'];?>	
				</div>		
				<div id="catmain64" class="grid_3 alpha" style="margin-left:12px;">
						<?php echo $row2['lhName'];?>
				</div>	<?php }?>				
			</div>	
		</div>
		<div class="grid_9 omega">
		<?php if($cat=='w' || $ct=='w') {?>
			<div class="grid_9" align="center"><img src="img/SLIDE.jpg" style="width: 826px; margin-left: -35px;"/>
			</div>
		<?php }?>	
		<?php if($cat=='dm' || $ct=='dm') {?>
			<div class="grid_9" align="center"><img src="img/hosting&domain copy.jpg" style="width: 826px; margin-left: -35px;"/>
			</div>
		<?php }?>	
		<?php if($cat=='pm' || $ct=='pm') {?>
			<div class="grid_9" align="center"><img src="img/phan mem.jpg" style="width: 826px; margin-left: -35px;"/>
			</div>
		<?php }?>
			<?php if($cat=='tv' || $ct=='tv') {?>
			<div class="grid_9" align="center"><img src="img/tuvan.jpg" style="width: 826px; margin-left: -35px;"/>
			</div>
		<?php }?>
		<?php 
		if($cat=='timkiem')
		{
			$keyword=$_REQUEST['search'];
			$query=mysql_query( "SELECT * from sanpham where spTitle Like '%".$keyword."%' Or spDetail Like '%".$keyword."%'");
		?>
			<div class="grid_9 omega">
				<?php 
				if(mysql_num_rows($query)==0)
				{?>
					<div class="grid_9" style="margin-top: 50px; font-size:24px; color:#FF0000;" align="center">
							<?php echo "Không tìm thấy sản phẩm nào !"; ?>
						</div>
				<?php }else
				{ ?>
					<div class="grid_9 title" style="margin-top: 15px;">
							<a href="?rmk=catmain&cat=w" > Tim kiem </a> </div>
					<div class="grid_09 " >
							Tìm thấy <?php echo mysql_num_rows($query); ?> sản phẩm .
					</div>		
						<?php while($row=mysql_fetch_array($query))
							{?>	
								<div class="grid_3 <?php if($i%3==0){ echo 'omega';}if($i%3==1  || $i==1){ echo 'alpha';}?>" style="margin-top: 15px;">
									<div class="grid_3 " style="margin-top: 15px;">
										<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row['spId'];?>" >
										<img src="<?php echo $row['spImg']; ?>" /></a>
									</div>
									<div class="grid_3 cat2">
										<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row['spId'];?>" ><?php echo $row['spTitle']; ?></a>
									</div>
								</div>		
							<?php }
				}
				?>
			</div>
		<?php } ?>
		
		<?php
		if($cat=='sanpham')
		{
			$spId=$_REQUEST['spId'];
			if($spId!="")
			{
				$query=mysql_query( "SELECT * from sanpham where spId=".$spId);
				$row=mysql_fetch_array($query);
			}
			if($spId=="")
			{
				//xac dinh bao nhieu dong
				$display =3;
				//tinh tong so trng can hien thi
				if(isset($_GET['page']) &&(int)$_GET['page'])
				{
					$page = $_GET['page'];
				}else
				{
				// neu chua xac dinh thi tim so trang 
					$query="select count(spId) from  sanpham ";
					$res=mysql_query($query);
					$row = mysql_fetch_array($res, MYSQLI_NUM);
					$record = $row[0];
					if($record > $display)
					{
						$page= ceil($record/$display);
					}else
					{
						$page = 1;
					}
				}
				$start = (isset($_GET['start']) && (int)$_GET['start']>=0) ? $_GET['start'] : 0;	
				$query=mysql_query( "SELECT * from sanpham  ORDER BY spId DESC LIMIT $start, $display");
			}
		?>
			<div class="grid_9 omega">
				<?php 
				if(mysql_num_rows($query)==0)
				{?>
					<div class="grid_9" style="margin-top: 50px; font-size:24px; color:#FF0000;" align="center">
							<?php echo "Sản phẩm đang được câp nhập . !"; ?>
						</div>
				<?php }else
				{ ?>
					<div class="grid_9 title" style="margin-top: 15px;">
						<a href="?rmk=catmain&cat=sanpham" > Sản phẩm </a> 
					</div>	
					
						<?php 
						if($spId=="")
						{
							while($row=mysql_fetch_array($query))
							{?>	
								<div class="grid_3 <?php if($i%3==0){ echo 'omega';}if($i%3==1  || $i==1){ echo 'alpha';}?>" style="margin-top: 15px;">
									<div class="grid_3 " style="margin-top: 15px;">
										<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row['spId'];?>" >
										<img src="<?php echo $row['spImg']; ?>" /></a>
									</div>
									<div class="grid_3 cat2">
										<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row['spId'];?>" ><?php echo $row['spTitle']; ?></a>
									</div>
								</div>		
							<?php }
						}	
						?>
						<?php if($spId!="")
						{?>	
							<div class="grid_3 alpha" style="margin-top: 15px;">
									<div class="grid_3 " style="margin-top: 15px;">
										<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row['spId'];?>" >
										<img src="<?php echo $row['spImg']; ?>" /></a>
									</div>
									<div class="grid_3 cat2">
										<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row['spId'];?>" ><?php echo $row['spTitle']; ?></a>
									</div>
								</div>			
							<div class="grid_6 omega">
								<?php echo $row['spDetail']; ?>
							</div>
							<div class="grid_9 cat4" align="center">
								<p><br /></p>
							</div>
							<div class="grid_9" style="font-weight:bold;">
							Các sản phẩm khác :
							</div>
							<?php 
							$sql3=mysql_query("select * from sanpham where spId !='".$spId."' limit 0,10");
							while($row3=mysql_fetch_array($sql3)){?>
								<div class="grid_9">
								<img src="img/images.jpg" />
								<a href="?rmk=catmain&cat=sanpham&spId=<?php echo $row3['spId'];?>" ><?php echo $row3['spTitle']; ?></a>
								</div>
							<?php  }?>
						<?php }
				}
				?>
			</div>
		<?php } ?>
		<?php if($ct==""){?>
			<div class="grid_9">
				<div class="grid_9 title" style="margin-top: 15px;">
					<?php if($cat=='w'){?><a href="?rmk=catmain&cat=w" >Web </a><?php } ?>
					<?php if($cat=='dm'){?><a href="?rmk=catmain&cat=dm" >Hosting & Domain</a><?php } ?>
					<?php if($cat=='pm'){?><a href="?rmk=catmain&cat=pm" >Phần mềm</a><?php } ?>
					<?php if($cat=='tv'){?><a href="?rmk=catmain&cat=tv" >Tư vấn</a><?php } ?>
					<?php if($cat=='t2'){?><a href="?rmk=catmain&cat=t2" >Tin tức</a><?php } ?>
				</div><p><br /></p>
				<?php while($row=mysql_fetch_array($sql))
				{
					{ if($i==1)
						{?>
							<div class="grid_9 cat2" style="width:780px;">
								<?php 
								if($cat=='w'){ echo substr($row['wDetail'],0,400).' . . .'; }
								if($cat=='pm'){ echo substr($row['pmDetail'],0,400).' . . .'; }
								if($cat=='dm'){ echo substr($row['dmDetail'],0,400).' . . .'; }
								?>
							</div><?php 
						}
						?>
							<?php if($cat=='w')
								{?>
									<?php if ($i==2)
									{?>
										<div class="grid_2">
											<div class="grid_2 cat2">
												<a href="?rmk=catmain&ct=w&cat=w&ct=w&wId=<?php echo $row['wId']; ?>">
												<?php echo $row['wTitle']; ?></a>
											</div>
											<div class="grid_2 alpha" align="left">
												<a href="?rmk=catmain&cat=w&ct=w&wId=<?php echo $row['wId'];?>&wStatus=<?php echo $row['wStatus'];?>">
												<img src="img/small-business-opportunity.jpg" /></a>
											</div>
											<div class="grid_2">
												<?php echo substr($row['wDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=w&wId=<?php echo $row['wId']; ?>"><img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}?>
									<?php if ($i==3)
									{?>
										<div class="grid_2">
											<div class="grid_2 cat2">
												<a href="?rmk=catmain&cat=w&ct=w&wId=<?php echo $row['wId']; ?>">
												<?php echo $row['wTitle']; ?></a>
											</div>
											<div class="grid_2">
												<a href="?rmk=catmain&cat=w&ct=w&wId=<?php echo $row['wId']; ?>wStatus=<?php echo $row['wStatus']; ?>">
												<img src="img/a1.jpg" /> </a>
											</div>
											<div class="grid_2">
												<?php echo substr($row['wDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=w&wId=<?php echo $row['wId']; ?>"><img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}?>
									<?php if ($i==4)
									{?>	
										<div class="grid_2">	
											<div class="grid_2 cat2">
												<a href="?rmk=catmain&cat=w&ct=w&wId=<?php echo $row['wId']; ?>"><?php echo $row['wTitle']; ?></a>
											</div>
											<div class="grid_2">
												<a href="?rmk=catmain&cat=w&ct=w&wId=<?php echo $row['wId']; ?>wStatus=<?php echo $row['wStatus']; ?>">
												<img src="img/business_solutions634266421672187500.jpg"  /> </a>
											</div>	
											<div class="grid_2">
												<?php echo substr($row['wDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=w&wId=<?php echo $row['wId']; ?>"><img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}?>
									<?php if ($i==5)
									{?>
										<div class="grid_2 omega">
											<div class="grid_2 cat2">
												<a href="?rmk=catmain&cat=w&wId=<?php echo $row['wId']; ?>"><?php echo $row['wTitle']; ?></a>
											</div>
											<div class="grid_2 ">
												<a href="?rmk=catmain&cat=w&ct=w&wId=<?php echo $row['wId'];?>wStatus=<?php echo $row['wStatus']; ?>">
												<img src="img/dich-vu-thiet-ke-website.jpg" /></a>
											</div>
											<div class="grid_2">
												<?php echo substr($row['wDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=w&wId=<?php echo $row['wId']; ?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}
								}?>
								<?php if($cat=='pm')
								{?>
									<?php if ($i==2)
									{?>
										<div class="grid_4 alpha">
											<div class="grid_4 cat2">
												<a href="?rmk=catmain&cat=pm&ct=pm&pmId=<?php echo $row['pmId']; ?>"><?php echo $row['pmTitle']; ?></a>
											</div>
											<div class="grid_4 " >
												<a href="?rmk=catmain&cat=pm&ct=pm&mmStatus=<?php echo $row['pmStatus']; ?>">
												<img src="img/ungdungdeban.jpg" /></a>
											</div>
											<div class="grid_4">
												<?php echo substr($row['pmDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=pm&ct=pm&pmId=<?php echo $row['pmId']; ?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}?>
									<?php if ($i==3)
									{?>
										<div class="grid_4 omega">
											<div class="grid_4 cat2">
												<a href="?rmk=catmain&cat=pm&ct=pm&pmId=<?php echo $row['pmId'];?>">
												<?php echo $row['pmTitle']; ?></a>
											</div>
											<div class="grid_4 ">
												<a href="?rmk=catmain&cat=pm&ct=pm&pmId=<?php echo $row['pmId'];?>">
												<img src="img/ungdungdienthoai copy.jpg" /></a>
											</div>
											<div class="grid_4">
												<?php echo substr($row['pmDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=pm&ct=pm&pmId=<?php echo $row['pmId'];?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}
								}?>
								<?php if($cat=='dm')
								{?>
									<?php if ($i==2)
									{?>
										<div class="grid_4 alpha">
											<div class="grid_4 cat2">
												<a href="?rmk=catmain&cat=dm&ct=dm&dmId=<?php echo $row['dmId']; ?>">
												<?php echo $row['dmTitle']; ?></a>
											</div>
											<div class="grid_4 " >
												<a href="?rmk=catmain&cat=dm&ct=dm&dmId=<?php echo $row['dmId']; ?>">
												<img src="img/domain .jpg" /></a>
											</div>
											<div class="grid_4">
												<?php echo substr($row['dmDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=dm&ct=dm&dmId=<?php echo $row['dmId']; ?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}?>
									<?php if ($i==3)
									{?>
										<div class="grid_4 omega">
											<div class="grid_4 cat2">
												<a href="?rmk=catmain&cat=dm&ct=dm&dmId=<?php echo $row['dmId']; ?>">
												<?php echo $row['dmTitle']; ?></a>
											</div>
											<div class="grid_4 ">
												<a href="?rmk=catmain&cat=dm&ct=dm&dmId=<?php echo $row['dmId']; ?>">
												<img src="img/hosting copy.jpg"/></a>
											</div>
											<div class="grid_4">
												<?php echo substr($row['dmDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=dm&ct=dm&dmId=<?php echo $row['dmId']; ?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
									}
								}?>
								<?php if($cat=='tv')
								{?>
										<div class="grid_9 omega cat3" style="width:800px;">
											<div class="grid_9 cat2" >
												<a href="?rmk=catmain&cat=tv&ct=tv&tvId=<?php echo $row['tvId']; ?>">
												<?php echo $row['tvTitle']; ?></a>
											</div>
											<div class="grid_9 " style="width:800px">
												<?php echo substr($row['tvDetail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=tv&ct=tv&tvId=<?php echo $row['tvId']; ?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
								}?>
								<?php if($cat=='t2')
								{?>
										<div class="grid_9 omega cat3" style="width:800px;">
											<div class="grid_9 cat2" >
												<a href="?rmk=catmain&cat=t2&ct=t2&t2Id=<?php echo $row['t2Id']; ?>">
												<?php echo $row['t2Title']; ?></a>
											</div>
											<div class="grid_9 " style="width:760px">
												<?php echo substr($row['t2Detail'],0,400).' . . .'; ?>
												<a href="?rmk=catmain&cat=t2&ct=t2&t2Id=<?php echo $row['t2Id']; ?>">
												<img src="img/chitiet.gif" /></a>
											</div>
										</div>	
									<?php 
								}?>
								
		<?php 		
				}$i++;
			}} ?>
			<?php if($ct=="w"){?>
				<div class="grid_9 title" style="margin-top: 15px;">
					<a href="?rmk=catmain&cat=w" >Web </a>
				<div class="grid_9 cat21" style="margin-top: 15px;">
					<?php echo $row1['wTitle']; ?>
				</div>
				<div class="grid_9">
					<?php echo $row1['wDetail']; ?>
				</div>
			<?php }?>
			<?php if($ct=="dm"){?>
				<div class="grid_9 title" style="margin-top: 15px;">
					<a href="?rmk=catmain&cat=dm" >Hosting & Domain </a>
				</div><p><br /></p>
				<div class="grid_9 cat21" style="margin-top: 15px;">
					<?php echo $row1['dmTitle']; ?>
				</div>
				<div class="grid_9">
					<?php echo $row1['dmDetail']; ?>
				</div>
			<?php }?>
			<?php if($ct=="pm"){?>
				<div class="grid_9 title" style="margin-top: 15px;">
					<a href="?rmk=catmain&cat=pm" >Phần mềm </a>
				</div><p><br /></p>
				<div class="grid_9 cat21" style="margin-top: 15px;">
					<?php echo $row1['pmTitle']; ?>
				</div>
				<div class="grid_9">
					<?php echo $row1['pmDetail']; ?>
				</div>
			<?php }?>
			<?php if($ct=="tv"){?>
				<div class="grid_9 title" style="margin-top: 15px;">
					<a href="?rmk=catmain&cat=tv" >Tư vấn </a>
				</div><p><br /></p>
				<div class="grid_9 cat21" style="margin-top: 15px;">
					<?php echo $row1['tvTitle']; ?>
				</div>
				<div class="grid_9" style="width:810px;">
					<?php echo $row1['tvDetail']; ?>
				</div>
			<?php }?>
				<?php if($ct=="t2"){
					$sql3=mysql_query("select * from tintuc where t2Id !='".$t2Id."' limit 0,5");
				?>
				<div class="grid_9 title" style="margin-top: 15px;">
					<a href="?rmk=catmain&cat=t2" >Tin tức</a>
				</div><p><br /></p>
				<div class="grid_9 cat21" style="margin-top: 15px;">
					<?php echo $row1['t2Title']; ?>
				</div>
				<div class="grid_9">
					<?php echo $row1['t2Detail']; ?>
				</div>
				<div class="grid_9 cat4" align="center">
					<p><br /></p>
				</div>
				<div class="grid_9" style="font-weight:bold;">
					Các bài viết khác :
				</div>
				<?php while($row3=mysql_fetch_array($sql3)){?>
					<div class="grid_9">
						<img src="img/images.jpg" />
						<a href="?rmk=catmain&cat=t2&ct=t2&t2Id=<?php echo $row3['t2Id']; ?>">
						<?php echo $row3['t2Title']; ?></a>
					</div>
			<?php } }?>
				<div class="grid_9 cat4" align="center">
					<p><br /></p>
				</div>
			</div>
			<?php 
			if($cat=='dv')
			{
				$web=mysql_query("select * from web");
				$row_web=mysql_fetch_array($web);
				$domain=mysql_query("select * from domain");
				$row_domain=mysql_fetch_array($domain);
				$phanmem=mysql_query("select * from phanmem");
				$row_phanmem=mysql_fetch_array($phanmem);
				$tuvan=mysql_query("select * from tuvan");
				$row_tuvan=mysql_fetch_array($tuvan);
			?>
				<div id="main" class="grid_9 alpha">
				<div id="main" class="grid_4 alpha">
					<div class="grid_4">
						<div class="grid_2 alpha"><img src="img/1.jpg" /></div>
						<div class="grid_2 omega title" align="center"><a href="?rmk=catmain&cat=w" >Web </a><br />&nbsp;<br /></div>	
					</div> 
					<div class="grid_4 content3">
						<div class="grid_4 content4"><?php echo substr($row_web['wDetail'],0,100);?></div> 	
					</div>			
				</div>
				<div id="main" class="grid_4 omega">
					<div class="grid_4">
						<div class="grid_2 alpha"><img src="img/2.jpg" /></div>
						<div class="grid_2 omega title" align="center"><a href="?rmk=catmain&cat=dm" >Hosting & Domain</a></div>
					</div> 
					<div class="grid_4 content2S" align="center">
						<div class="grid_4 content2"><?php echo substr($row_domain['dmDetail'],0,100);?></div> 
					</div>		
				</div>
				<div id="main" class="grid_4 alpha" style="margin-top:30px; margin-left:90px">
					<div class="grid_4">
						<div class="grid_2 alpha"><img src="img/3.jpg" /></div>
						<div class="grid_2 omega title" align="center"><a href="?rmk=catmain&cat=pm" >Phần mềm</a> <br />&nbsp;<br /></div>
					</div> 
					<div class="grid_4 content2">
						<div class="grid_4 content2"><?php echo substr($row_phanmem['pmDetail'],0,100);?></div> 
					</div>		
				</div>
				<div id="main" class="grid_4 omega" style="margin-top:-141px;">
					<div class="grid_4">
						<div class="grid_2 alpha"><img src="img/4.jpg" /></div>
						<div class="grid_2 omega title" align="center"><a href="?rmk=catmain&cat=tv" >Tư vấn</a> 
						 <br />&nbsp;<br /></div>
					</div> 
					<div class="grid_4">
						<div class="grid_4 content4"><?php echo substr($row_tuvan['tvDetail'],0,100);?></div> 	
					</div>	
				</div>
			<?php }
			?>
			<?php if($cat=='t2' && $t2Id=="")
			{?>
				<div class="grid_9" align="center">
				<ul class="nav" style="margin-top: -78px; margin-left: 324px;">
				<?php 
				if($page > '1')
				{
					//hien thi so trang
					$next = $start+$display;
					$prev = $start-$display;
					$current = ($start/$display)+1;
					//hien thi trang prev
					if($current != '1')
					{
						echo "<li><a href='?rmk=catmain&cat=t2&start=$prev&page=$page'>Quay lại</a></li>";
					}
					//hien thi so link
					for($i=1;$i<=$page;$i++)
					{
						if($current != $i)
						{
							echo "<li><a href='?rmk=catmain&cat=t2&start=".($display*($i-1))."&page=$page'>$i</a></li>";
						}else
						{
							echo "<li class='curent'>$i</li>";
						}
					}//het for
					//hien thi trang next
					if($current !=  $page)
					{
						echo "<li><a href='?rmk=catmain&cat=t2&start=$next&page=$page'>Trang sau</a></li>";
					}
				}	
			}
			?>
			<?php if($cat=='sanpham' && $spId=="")
			{?>
				<div class="grid_9" align="center">
				<ul class="nav" style="margin-top: -78px; margin-left: 324px;">
				<?php 
				if($page > '1')
				{
					//hien thi so trang
					$next = $start+$display;
					$prev = $start-$display;
					$current = ($start/$display)+1;
					//hien thi trang prev
					if($current != '1')
					{
						echo "<li><a href='?rmk=catmain&cat=sanpham&start=$prev&page=$page'>Quay lại</a></li>";
					}
					//hien thi so link
					for($i=1;$i<=$page;$i++)
					{
						if($current != $i)
						{
							echo "<li><a href='?rmk=catmain&cat=sanpham&start=".($display*($i-1))."&page=$page'>$i</a></li>";
						}else
						{
							echo "<li class='curent'>$i</li>";
						}
					}//het for
					//hien thi trang next
					if($current !=  $page)
					{
						echo "<li><a href='?rmk=catmain&cat=sanpham&start=$next&page=$page'>Trang sau</a></li>";
					}
				}	
			}
			?>
			</ul></div>
		</div>
	</div>